package com.huadao.cart_ccs.data.task;

import java.util.concurrent.ScheduledFuture;

import io.reactivex.disposables.Disposable;

public class ShakeTableTask extends OperateTask {
    private int time;//秒
    private ScheduledFuture scheduledFuture;
    private Disposable progressBarDisposable;//进度条

    public int getTime() {
        return time;
    }

    public void setTime(int time) {
        this.time = time;
    }

    public ScheduledFuture getScheduledFuture() {
        return scheduledFuture;
    }

    public void setScheduledFuture(ScheduledFuture scheduledFuture) {
        this.scheduledFuture = scheduledFuture;
    }

    public Disposable getProgressBarDisposable() {
        return progressBarDisposable;
    }

    public void setProgressBarDisposable(Disposable progressBarDisposable) {
        this.progressBarDisposable = progressBarDisposable;
    }

    //取消关闭任务
    public void cancelCloseTask() {
        //如果失败，就取消关闭任务
        if (scheduledFuture != null) {
//            if (!scheduledFuture.isDone()) {
//                scheduledFuture.cancel(true);
//            }
            scheduledFuture.cancel(true);
            scheduledFuture = null;
        }
    }
}
